package HeSuanServer.controller;

import HeSuanServer.POJO.Org;
import HeSuanServer.POJO.OrgSearch;
import HeSuanServer.POJO.OrgUmSearch;
import HeSuanServer.POJO.R.Result;
import HeSuanServer.POJO.Rorg;
import HeSuanServer.service.OrgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @描述:
 * @author: LH
 * @date: 2023/4/7
 */
@CrossOrigin
@RequestMapping("org")
@RestController
@Slf4j
public class orgController {
    @Autowired
    private OrgService orgService;
    @GetMapping("getAll")
    public Result getAll(){
        return orgService.getAll();
    }
    @PostMapping("findByPage")
    public Result findByPage(@RequestBody OrgSearch orgSearch){
        return orgService.findByPage(orgSearch);
    }
    @GetMapping("byId")
    public Result byId(Integer id){
        return orgService.byId(id);
    }
    @PostMapping("edit")
    public Result edit(@RequestBody Org org){
        return orgService.edit(org);
    }
    @PostMapping("add")
    public Result add(@RequestBody Org org){
        return orgService.add(org);
    }
    @GetMapping("del")
    public Result del(Integer id){
        return orgService.delById(id);
    }
    @PostMapping("sq")
    public Result sq(@RequestBody Rorg rorg){
        return orgService.sq(rorg);
    }
    @PostMapping("login")
    public Result login(@RequestBody Org org){
        return orgService.login(org);
    }
    @GetMapping("gety")
    public Result gety(Integer id){
        return orgService.gety(id);
    }
    @GetMapping("totaly")
    public Result totaly(Integer id){
        return orgService.totaly(id);
    }
    @GetMapping("bili")
    public Result bili(Integer id){
        return orgService.bili(id);
    }
    @GetMapping("wt")
    public Result wt(Integer id){
        return orgService.wt(id);
    }
    @GetMapping("tj")
    public Result tj(Integer id){
        return orgService.tj(id);
    }
    @PostMapping("Search")
    public Result Search(@RequestBody  OrgUmSearch orgUmSearch){
        return orgService.UmSearch(orgUmSearch);
    }
    @PostMapping("orgedit")
    public Result orgedit(@RequestBody Org org){
        return orgService.orgedit(org);
    }
    @PostMapping("rfindByPage")
    public Result rfindByPage(@RequestBody OrgSearch orgSearch){
        return orgService.getRorg(orgSearch);
    }
    @PostMapping("tg")
    public Result tg(@RequestBody Map<String,String> map){
        return orgService.tg(map);
    }
    @GetMapping("rdel")
    public Result rdel(Integer id){
        return orgService.rdel(id);
    }
}
